//index.js
//获取应用实例
const Http = require('../../models/HTTP');

Page({
  data: {
    offset:0,
    playlists:[]
  },
  onLoad(){
    Http.getCatData(this.data.offset).then(res=>{
      var playlists = res.data.playlists;
      this.setData({
        playlists
      })
    })
  },
  onReachBottom(){
     var offset = this.data.offset;
     offset+=35;
     Http.getCatData(offset).then(res=>{
       var {playlists} = res.data;
       this.setData({
         offset,
         playlists:this.data.playlists.concat(playlists)
       })
     })
  }
})
/* 
1.自己实现的使用  使用async 和await去得到结果 
2.余下的页面有上拉刷新的时候将这段逻辑加进去
3.自己去看一下grid布局
*/
